png: Correct endianness for big-endian machines
authorSimon McVittie <smcv@debian.org>
Sat, 8 Jan 2022 16:39:36 +0000 (16:39 +0000)
committerSimon McVittie <smcv@debian.org>
Sat, 8 Jan 2022 17:09:29 +0000 (17:09 +0000)
commit979c124e57278c6f62301c7aa495f103cafa18ce
treef559619253b77fefd9590eb575294790812df48f
parentbed67edd2ebd5daefd0a1f68ea64ef603cbdeb8b
png: Correct endianness for big-endian machines

libpng wants to receive samples in either RGB or RGBA order, whether
each sample is big-endian or not. This resolves test failures in
testsuite/gdk/memorytexture.c (and a lot of reftests) on s390x, and
probably the PowerPC family too.

Modifying the test to show the color in use and write out the PNG bytes
to a file, and running the memorytexture test on s390x, produces a PNG
that loads with the correct color values in GIMP (on an x86_64 machine),
which seems like evidence that this is the correct change and not just
compensating errors.

Resolves: https://gitlab.gnome.org/GNOME/gtk/-/issues/4616
Signed-off-by: Simon McVittie <smcv@debian.org>
gdk/loaders/gdkpng.c